package py.com.alfa.escriba.gui.controller.view;

import java.util.HashMap;
import java.util.Set;

public class ViewFragment {
	
	private Boolean enable;
	private HashMap<Fragment, Boolean> fragments;
	
	public ViewFragment() {
		setFragments(new HashMap<Fragment, Boolean>());
	}
	
	public ViewFragment enable(){
		setEnable(true);
		return this;
	}
	
	public ViewFragment disable(){
		setEnable(false);
		return this;
	}
	
	public ViewFragment disableAll(){
		setEnable(false);
		Set<Fragment> frags = getFragments().keySet();
		for(Fragment frag:frags){
			getFragments().put(frag, getEnable());
		}
		return this;
	}
	
	public Boolean getFragment(Fragment fragment){
		if(getFragments().containsKey(fragment)){
			return getFragments().get(fragment);
		}
		return false;
	}
	
	public Boolean getEnable() {
		return enable;
	}
	public void setEnable(Boolean enable) {
		this.enable = enable;
	}

	public HashMap<Fragment, Boolean> getFragments() {
		return fragments;
	}

	public void setFragments(HashMap<Fragment, Boolean> fragments) {
		this.fragments = fragments;
	}
	

}
